import React, { Component } from "react";
import MainLayout from "../../../../component/mainLayout/mainLayout";
import { InterfaceG } from "@config/Config";
import yhTools from "@tools/yh";
import { Toast } from "antd-mobile";
import "./index.scss";
//绑卡宣传广告
class AddBankAd extends Component {
	constructor(props) {
		super(props);
	}

	/**
	 * @msg: 去绑卡按钮事件
	 * @param {*}
	 * @return {*}
	 */
	xhfCreditApplying_bindPageButtonEvent = () => {
		Toast.loading("加载中", 100);
		const params = {
			url: InterfaceG.xhfCreditApplying_bindPageButtonEvent
		};
		yhTools.request(params).then(res => {
			Toast.hide();
			if (res.code === "0") {
				this.props.history.push({
					pathname: "/bankManageList"
				});
			} else {
				Toast.info(res.message, 2);
			}
		});
	};

	render() {
		const _pageParams = {
			header: {
				title: "绑卡指引"
			},
			cacheLifecycles: this.props.cacheLifecycles,
			history: this.props.history
		};
		return (
			<MainLayout pageParams={_pageParams}>
				<div className="page-addBankAdv">
					<div className="addBankAdv-pic">
						<img
							className="bind_bank_adv"
							src={
								"https://jrcdn.yonghui.cn/yh_supermarket_sdk/yhLife/xhfHome/bind_card_process.png"
							}
							alt=""
						/>
					</div>
					<div
						className="addBankAdv-btn ui-flex ui-flex-justify-center ui-flex-align-center"
						onClick={() => {
							yhTools.debounceNew(
								this.xhfCreditApplying_bindPageButtonEvent(),
								200
							);
						}}
					>
						<span className="btn-text f-36 f-b">绑卡</span>
					</div>
				</div>
			</MainLayout>
		);
	}
}
export default AddBankAd;
